package com.itheima.udp3;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;

public class SendClient {

    public static void main(String[] args) throws IOException {
        //创建对象
        DatagramSocket ds = new DatagramSocket();
        while (true) {
            //组织数据
            String s= new Scanner(System.in).nextLine();
            byte[] bytes = s.getBytes();
            DatagramPacket dp = new DatagramPacket(bytes, 0, bytes.length, InetAddress.getByName("255.255.255.255"), 10010);
            //发送数据
            ds.send(dp);
        }


    }
}
